//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类;

public class demo_1922 {
    private static final int mod = 1000000007;

    public demo_1922() {
    }

    public int countGoodNumbers1(long n) {
        int num = (int)(Math.pow((double)10.0F, (double)9.0F) + (double)7.0F);
        long out = 1L;

        for(long i = 0L; i < (n + 1L) / 2L; ++i) {
            out = out * 5L % (long)num;
        }

        for(long i = 0L; i < n / 2L; ++i) {
            out = out * 4L % (long)num;
        }

        return (int)out;
    }

    public int countGoodNumbers(long n) {
        return (int)(pow(5L, (n + 1L) / 2L) * pow(4L, n / 2L) % 1000000007L);
    }

    public static long pow(long x, long n) {
        long res;
        for(res = 1L; n > 0L; n >>= 1) {
            if ((n & 1L) > 0L) {
                res = res * x % 1000000007L;
            }

            x = x * x % 1000000007L;
        }

        return res;
    }
}
